#!/usr/bin/env node

/**
 * Copyright (c) Mr Denzel.
 **/

const {Command} = require('commander');
const packageJSON = require('./package.json');
const create = require('./src/index');
const utils = require('./src/utils');
var fs = require('fs');
const childProcess = require('child_process')
const program = new Command();
program
    .command(packageJSON.name)
    .version(packageJSON.version, '-v, --version')
    .action(function(cmd, env){
        // cmd._name  名称 
        // env 命令行数组  例如  ['init', '-r']
        if(!env){
            utils.log('red',("命令有误  必须有参数 例：init、-v、-h、-update"))
        }else{
            let pathArr = process.cwd().split("/");
            create(env,pathArr[pathArr.length-1]);
        }
    });
program.parse(process.argv);